﻿using Futajma.MigrationStudio.SharePointPersistence;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Futajma.MigrationStudio.SharePointPersistance
{
    public class SharePoint2010MigrationStatistic
    {
        public void SaveStatistics(int folderId, MigrationStatistic statistics)
        {
            ExtendedClientContext clientContext = new ExtendedClientContext(Settings.MigrationPortalUrl);
            var folder = Utils.GetFolder(clientContext, folderId, Settings.MigrationListTitle);

            folder[Settings.Statistics_MigrationActualsSourceElementsFieldName] = statistics.MigrationActualsSourceElements;
            folder[Settings.Statistics_MigrationActualsSourceSizeFieldName] = statistics.MigrationActualsSourceSize;
            folder[Settings.Statistics_MigrationPlannedSourceElementsFieldName] = statistics.MigrationPlannedSourceElements;
            folder[Settings.Statistics_MigrationPlannedSourceSizeFieldName] = statistics.MigrationPlannedSourceSize;
            folder.Update();

            clientContext.ExecuteQuery();  


        }
        
    }
}
